package seven.test_7_8;

import java.util.Scanner;
import java.util.Stack;

public class TestMain {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        Stack<Character> stack = new Stack<>();
        int i = 1;
        stack.push(str.charAt(0));
        while (i < str.length()) {
            char c = str.charAt(i);
            if(stack.size() == 0) {
                stack.push(c);
                i++;
            } else {
                char tmp = stack.peek();
                while (tmp == c) {
                    while (i < str.length() && tmp == c) {
                        c = str.charAt(i);
                        i++;
                    }
                    stack.pop();
                    if(stack.size() > 0) {
                        tmp = stack.peek();
                    }
                }
                stack.push(c);
                i++;
            }

        }
        if(stack.size() == 0) {
            System.out.println(0);
        } else {
            for (int j = 0; j < stack.size(); j++) {
                System.out.print(stack.get(j));
            }
        }
    }
}
